package com.cater.utils;

import java.util.List;

import com.cater.sys.entity.Area;

/**
 * @author 作者: sd
 * @date 创建时间：2017年3月14日 下午4:37:45
 * @version 1.0
 */
public class ZtreeUtil {
	public ZtreeObject[] getTreeObjects(List<Area> list) {
		ZtreeObject[] trees = new ZtreeObject[list.size()];
		for (int i = 0; i < trees.length; i++) {
			ZtreeObject object = new ZtreeObject();
			Area area = list.get(i);
			object.setId(area.getId());
			object.setpId(area.getFatherId());
			object.setName(area.getTitle());
			if (area.getFatherId() == 0) {
				object.setOpen(true);
				object.setNocheck(true);
			}
			trees[i] = object;
		}
		return trees;
	}
}
